<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "user".
 *
 * @property int $id
 * @property string $self_code 自己邀请码
 * @property string $mobile 手机号
 * @property string $invite_code 邀请码
 * @property int $total_invite 总邀请人数
 * @property int $ad_num 广告牌数量
 * @property int $p2p_num p2p币数量
 * @property int $status 用户状态
 * @property string $access_token 认证key
 * @property int $created_at 创建时间
 * @property int $updated_at 修改时间
 * @property int $expired_at 过期时间
 */
class User extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'user';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['mobile',  'created_at', 'updated_at', 'expired_at'], 'required'],
            [['created_at', 'updated_at', 'expired_at'], 'integer'],
            [['mobile'], 'string', 'max' => 11],
            [['status'], 'string', 'max' => 4],
            [['beizhu'], 'string', 'max' => 255],
            [['mobile'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'referer' => '用户来源',
            'mobile' => '手机号',
            'beizhu' => '查询平台',

            'status' => '用户状态',
            'access_token' => '认证key',
            'created_at' => '创建时间',
            'updated_at' => '修改时间',
            'expired_at' => '过期时间',
        ];
    }
}
